function jumpPage(pageNo) {
	$("#pageNo").val(pageNo);
	$("#mainForm").submit();
}

$(document).ready(function(){
	$("#mainForm  table tr:nth-child(even)").addClass("odd");
	var orderByStr = $("#orderBy").val();
	var orderStr =   $("#order").val();
	 if(orderByStr){
	  var orderByArray = orderByStr.split(",");
	  var orderArray = orderStr.split(",");
	  	for(var index=0;index < orderByArray.length;index++){
	  		var orderBy = orderByArray[index];
	  		var order = orderArray[index];
			if(order=="desc"){
				$("a[id='"+orderBy+"']").addClass("desc");;
			}else if (order=="asc"){
				$("a[id='"+orderBy+"']").addClass("asc");
			}
	  	} 
	 }
});

function sort(orderBy, defaultOrder) {
	if(!orderBy || !defaultOrder ) { //判断非空,为空则返回为空
		return ;
	}
	//$("#orderBy").val(); page.orderBy 'createDate,title'  page.order 'desc,asc'
	 var orderByStr = $("#orderBy").val();
	 var orderStr = $("#order").val();
	  if(!orderByStr) { //取不到值
			$("#orderBy").val(orderBy);
			$("#order").val(defaultOrder); 
			$("#mainForm").submit();
			return ;
	  }
	  var orderByArray = orderByStr.split(",");
	  var orderArray = orderStr.split(",");
	  var index = $.inArray(orderBy, orderByArray)
	  /**
	   * 找到 
	   */
	  if(index !=-1) {
		  if(orderArray[index] =="desc"){
			  orderArray[index] ="asc";
		  } else if(orderArray[index] =="asc"){
			  orderArray[index] ="desc";
		  }
		  orderByStr = orderByArray.join(",");
		  orderStr =  orderArray.join(",");
	  } else { //没找到则进行累加
		  orderByStr =  orderByStr +","+ orderBy;
		  orderStr =   orderStr +","+ defaultOrder;
	  }
		$("#orderBy").val(orderByStr);
		$("#order").val(orderStr); 
		$("#mainForm").submit();
}

function search() {
	$("#order").val("");
	$("#orderBy").val("");
	$("#pageNo").val("1");
	$("#mainForm").submit();
}